package math

import (
	"JVM/Jvmgo/GoToJVM/instructions/base"
	"JVM/Jvmgo/GoToJVM/runtimeData"
)

/*
	这里是进行数学 * 运算
*/

type IMUL struct {
	base.NoOperandsInstruction
}
type LMUL struct {
	base.NoOperandsInstruction
}
type FMUL struct {
	base.NoOperandsInstruction
}
type DMUL struct {
	base.NoOperandsInstruction
}

func (self IMUL) Execute(frame *runtimeData.Frame) {
	stack := frame.OperandStack()
	val1 := stack.PopInt()
	val2 := stack.PopInt()
	res := val1 * val2
	stack.PushInt(res)
}
func (self LMUL) Execute(frame *runtimeData.Frame) {
	stack := frame.OperandStack()
	val1 := stack.PopLong()
	val2 := stack.PopLong()
	res := val1 * val2
	stack.PushLong(res)
}
func (self FMUL) Execute(frame *runtimeData.Frame) {
	stack := frame.OperandStack()
	val1 := stack.PopFloat()
	val2 := stack.PopFloat()
	res := val1 * val2
	stack.PushFloat(res)
}
func (self DMUL) Execute(frame *runtimeData.Frame) {
	stack := frame.OperandStack()
	val1 := stack.PopDouble()
	val2 := stack.PopDouble()
	res := val1 * val2
	stack.PushDouble(res)
}
